<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { inject } from "vue";
onLaunch(() => {
  const userInfo: any = uni.getStorageSync("userInfo");
  if (!userInfo) {
    uni.navigateTo({ url: "pages/login/index" });
    return;
  }
  console.log("App Launch");
  uni.hideTabBar();
  const global: any = inject("global");
  uni.getSystemInfo({
    success: function (e: any) {
      // #ifndef MP
      global.StatusBar = e.statusBarHeight;
      if (e.platform == "android") {
        global.CustomBar = e.statusBarHeight + 50;
      } else {
        global.CustomBar = e.statusBarHeight + 45;
      }
      // #endif
      // #ifdef MP-WEIXIN
      global.StatusBar = e.statusBarHeight;
      let custom = wx.getMenuButtonBoundingClientRect();
      global.Custom = custom;
      global.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
      // #endif
      // #ifdef MP-ALIPAY
      global.StatusBar = e.statusBarHeight;
      global.CustomBar = e.statusBarHeight + e.titleBarHeight;
      // #endif
    },
  });
});
onShow(() => {
  console.log("App Show");
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style>
@import "colorui/main.css";
@import "colorui/icon.css";
@import "colorui/animation.css";
</style>
